In [54]:
%pylab inline
import warnings
from inet import DataLoader, __version__
from inet.motifs import iicounter
from inet.utils import II_slice
print('Inet version {}'.format(__version__))
In [3]:
# use filenames in the dataset to read list of distances to be read
mydataset = DataLoader('../data/PV')
pvfiles = [ i for i in range(len(mydataset)) if int(mydataset.filename(i)[0])>1 ]
print('{} experiments with 2 or more PV-cells'.format(len(pvfiles)))
In [121]:
# read distances from between inhibitory neurons
def read_dist(fname):
"""
get distances between inhibitory pairs of neurons
from a matrix of intersomatic distances.
Argument:
fname: string
the matrix name to that contains the connected synapses (*.syn)
"""
# take all non-diagonal elements
mypath = '../data/PV/' + fname[:-3] + 'dist'
try:
D = np.loadtxt(mypath)
D = II_slice(D, int(fname[0]))
idx = np.where(~np.eye(D.shape[0], dtype = bool))
mydist = np.abs(D[idx]).tolist()
return(mydist)
except IOError:
warnings.warn(mypath + ' not found!')
return([])
In [122]:
dist_tested = list()
for i in pvfiles:
dist_tested += read_dist(mydataset.filename(i))
In [123]:
print('{} total distances read'.format(len(dist_tested)))
In [124]:
mybins = arange(0,600, 50)
plt.hist(dist_tested, bins = mybins, facecolor='white', lw=2);
plt.ylim(ymax=50);
plt.ylabel('Inhbitory chemical synapses');
plt.xlabel('Intersomatic distance ($\mu$m)');
In [206]:
def read_rec_dist(fname):
"""
get distances between bidirectionally connected interneurons
from a matrix of intersomatic distances.
Argument:
fname: string
the matrix name to that contains the connected synapses (*.syn)
"""
# take all non-diagonal elements
mydistpath = '../data/PV/' + fname[:-3] + 'dist'
try:
D = II_slice(np.loadtxt(mydistpath), int(fname[0]))
except IOError:
warnings.warn(mydistpath + ' not found!')
return([])
try:
S = np.loadtxt('../data/PV/'+fname)
except IOError:
warnings.warn(fname + ' not found!')
return([])
S = II_slice(S, int(fname[0]))
S[S==2] = 0 # remove gaps
S[S==3] = 1 # remove gaps in chemical
x,y = np.nonzero(S)
ids = zip(x,y)
mydist = list()
if ids>0:
for i,j in ids:
if S[j,i] == 1:
mydist.append(D[i,j])
print(np.unique(np.abs(mydist)))
return( np.unique(np.abs(mydist)).tolist() )
In [159]:
# Number of bidirectionally connected interneurons
mydataset.motif['ii_c2']
Out[159]:
In [160]:
# select experiments with bidirectional motifs
mybidirec = [i for i in range(len(mydataset)) if mydataset.motifs(i)['ii_c2']['found']>0 ]
for i in mybidirec:
print('Experiment {:3d}, filename: {}'.format(i, mydataset.filename(i)))
In [211]:
dist_found = list()
for i in mybidirec:
dist_found += read_rec_dist(mydataset.filename(i))
In [212]:
dist_found
Out[212]:
In [226]:
mybins = arange(0,550, 50)
bid_tested = np.unique(dist_tested)
plt.hist(bid_tested, bins = mybins, facecolor='white', lw=2);
plt.ylim(ymax=20);
plt.ylabel('Inhbitory chemical synapses');
plt.xlabel('Intersomatic distance ($\mu$m)');
plt.hist(dist_found, bins = mybins, facecolor='gray', lw=2);
In [ ]: